/*
 * @(#)TransferRule.java 1.0 3/30/06
 *
 * Made by LEFT thesis group
 * 
 * Transfer dictionary Module
 * 
 * The TransferRule class is the format or the structure of the transfer rule
 * the rule contains the correspondence of english and filipino f-descriptions
 */
package org.dlsu.mt.parser.TRANSFER;
import java.util.Vector;

import org.dlsu.mt.parser.FStructure;
import org.dlsu.mt.parser.FStructureElement;

public class TransferRule{

	private final String RuleNumber;
	
	//One of these two attributes will be the condition side depending on the direction of the translation
	private FStructure language1;//f-descriptions for english
	private FStructure language2;//f-descriptions for filipino
	private Vector retainedLanguage1FElements;
	private Vector retainedLanguage2FElements;
	private int relatedRuleLang2;
	private int relatedRuleLang1;
	
	//constructor that assigns a rule number as a string to a transfer rule
	public TransferRule(String num){
		
		RuleNumber = num;
		retainedLanguage1FElements = new Vector();
		retainedLanguage2FElements = new Vector();
	}
	
	public void setRetainedFElements(Vector vec, char lang){
		
		if(lang == '1'){
			
			retainedLanguage1FElements = vec;
			
		}else if(lang == '2')
		{
			//System.out.println("pasok");
					
			retainedLanguage2FElements = vec;
			
			//System.out.println(retainedFilipinoFElements.size() + "ito un");
			
		}
	}
	
	public void addLanguage1RetainedFElements(FStructureElement fs){
		
		retainedLanguage1FElements.add(fs);
		
	}
	
	public void addLanguage2RetainedFElements(FStructureElement fs){
		
		retainedLanguage2FElements.add(fs);
		
	}
	
	
	public int getRelatedRuleLang2(){
		return relatedRuleLang2;
	}
	public int getRelatedRuleLang1(){
		return relatedRuleLang1;
	}
	
	
	public Vector getLanguage1RetainedFElements(){
		
		return retainedLanguage1FElements;
	}
	
	public Vector getLanguage2RetainedFElements(){
		
		return retainedLanguage2FElements;
	}
	
	
	
	
		
	//adds an fdescription class to either the filipino or english vector for a transfer rule
	public void setFStructure(FStructure fs, char lang){
		
		//FDescription f = new FDescription(func, val);
		
		if(lang == '1')	
			language1 = (FStructure)fs.clone();
		else{
			//System.out.println("error2");
			language2 = (FStructure)fs.clone();
		}
	}
	
	
	public void setRelatedRuleLang2(int rr){
		relatedRuleLang2 = rr;
	}
	
	public void setRelatedRuleLang1(int rr){
		relatedRuleLang1 = rr;
	}
	
	public FStructure getLanguage1FStructure(){	
		
		return language1;
	}
	
	public FStructure getLanguage2FStructure(){
		return language2;
	}
	
	
	
}